package com.neo4j.neo4jcloud.service.impl;

import com.neo4j.neo4jcloud.entity.Person;
import com.neo4j.neo4jcloud.mapper.PersonRepository;
import com.neo4j.neo4jcloud.service.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author kabuqinuo
 * @date 2020/3/26 12:07
 */

/**
 * 单个节点person增删查实现类
 */
@Service
public class PersonServiceImpl implements PersonService {

    @Autowired
    private PersonRepository personRepository;


    @Override
    public Person addPerson(Person person) {
        return personRepository.save(person);
    }

    @Override
    public Person findOneById(Long id) {
        return personRepository.findById(id).get();
    }

    @Override
    public void deletePerson(Long id) {
        personRepository.deleteById(id);
    }
}
